package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.domain.db.AnalysisByDay;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface AnalysisByDayMapper extends BaseMapper<AnalysisByDay> {

    //查询累计用户数量
    @Select("select sum(num_registered) from tb_analysis_by_day")
    Long findUserTotal();

    //查询一段时间的用户活跃数量
    @Select("select sum(num_active) from tb_analysis_by_day where record_date between #{start} and #{end}")
    Long findActiveUserCountInPeriod(@Param("start") String start,@Param("end") String end);

    //查询指定日期的记录
    @Select("select * from tb_analysis_by_day where record_date = #{recordDate}")
    AnalysisByDay findByRecordDate(String recordDate);
}